import {h, render} from 'vue'
import CommonDialog from "./CommonDialog";
import ChooseDialog from "./ChooseDialog";

const Dialog = {
    custom(component, props) {
        const container = document.createElement('div')
        document.body.appendChild(container)
        props.onDismiss = () => {
            container.remove()
            render(null, container)
        }
        render(h(component, props), container)
    },

    /**
     * 显示通用弹窗
     */
    common(props) {
        this.custom(CommonDialog, props)
    },

    /**
     * 底部选择弹窗
     */
    choose(props) {
        this.custom(ChooseDialog, props)
    }
}


export default Dialog